
var fs = require('fs');

var crawler = require("crawler");

var c = new crawler({

    encoding: null,

    jQuery: false,// set false to suppress warning message.

    callback: function (err, res, done) {
        if (err) {
            console.error(err.stack);
        } else {
            //通过流的方式，把图片写到本地/image目录下，并用新闻的标题和图片的标题作为图片的名称。     
            request(img).pipe(fs.createWriteStream('./img/' + news_title + '---' + img_filename));     
            
        }
        done();
    }
});

// c.queue('https://img1.doubanio.com/view/subject/s/public/s2659208.jpg');


for (var a = 0; a <= 225; a += 25) {

    var url = 'https://book.douban.com/top250?start=' + a

    c.queue(url);
}